package org.microsites.util;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class BeanFactory implements ApplicationContextAware {
	
	private static ApplicationContext ctx = null;

	public void setApplicationContext(ApplicationContext ctx) throws BeansException {
		BeanFactory.ctx = ctx;
	}
	
	public static Object get(String bean) {
		return ctx == null ? null : ctx.getBean(bean);
	}

}
